package com.zbmy.plugin.im.server.core.zookeeper.server;

import java.util.Random;

public class ZKUserOperator {
	public static ZKServiceStore zkServiceDiscovery = new ZKServiceStore();

	public static void getChatServer(String userId) {
		zkServiceDiscovery.getUserNodeInfo(userId);
	}
	
	public static void saveChatUserServer(String userId, String serverId) {
		zkServiceDiscovery.createUserNode(userId, serverId);
	}
	
	public static void test(){
		new Thread(new Runnable() {
			
			@Override
			public void run() {
				while(true){
					saveChatUserServer(new Random().nextInt(10) + "", new Random().nextInt(10) + "");
					try {
						Thread.sleep(1000);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
				}
			}
		}).start();
	}
}
